home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8359 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Something about typedef and functions I don't understand
  5. Date: 01 Mar 1996 15:59:08 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar1085908@qcd.lanl.gov>
  8. References: <4h6924$ihl@pith.uoregon.edu>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: Pat O'Connor's message of 1 Mar 1996 07:30:12 GMT
  13.  
  14. In article <4h6924$ihl@pith.uoregon.edu>
  15. Pat O'Connor <pwoc@darkwing.uoregon.edu> writes:
  16.  
  17. PO: I just ran into a problem using typedef for declaring aliases for function
  18. PO: types.  Now, I thought that when I say for example,
  19. PO:     typedef double (*DFunc)(double x);
  20. PO: that I could use DFunc to declare (but not define) functions. But.... when
  21.  
  22. Wrong. Dfunc is the type of _pointer_ to function. What you want is 
  23.  
  24. typedef double DFunc (double x);
  25.  
  26. Now, DFunc can be used to declare the appropriate kind of function,
  27. and because of the `reqrite rule', function pointer _parameters_ of
  28. other functions. If you need function pointer in other situations, you
  29. have to write DFunc * instead.
  30.  
  31. Cheers
  32. Tanmoy
  33. --
  34. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  35. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  36. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  37. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  38. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  39. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  40.